package com.acme.bankapp.service.bank;

import com.acme.bankapp.domain.bank.Account;
import com.acme.bankapp.domain.bank.Bank;
import com.acme.bankapp.domain.bank.Client;

/**
 * Class which provide some operations
 * to add/remove/etc. manipulations
 * 
 * @author render1980
 *
 */
public class BankService {
	public static void addClient(Bank bank, Client client){
		bank.addClient(client);
	}
	
	/**
	 * Method to remove client from bank
	 * 
	 * @param bank	desired bank
	 * @param client	client to be removed from the bank
	 */
	public static void removeClient(Bank bank, Client client){
		bank.removeClient(client);
	}
	
	/**
	 * Method which prints max amount to withdraw from the client account
	 * of some bank
	 * 
	 * @param bank	bank which contains clients which contains accounts
	 * which has balance value
	 */
	public static void printMaximumAmountToWithdraw(Bank bank) {
		Client[] bankClients = bank.getClients();
		for(Client client: bankClients) {
			System.out.println("***Client: " + client.getName() + " ***");
			Account[] accounts = client.getAccounts();
			for(Account account: accounts) {
				System.out.println("***Account max amount to withdraw: " + account.maximumAmountToWithdraw() +  " ***");
			}
			System.out.println();
		}
	}
}
